from django.db import models


# Create your models here.

class BookInfo(models.Model):
    name = models.CharField(max_length=100)

    def __str__(self):
        return self.name

    class Meta:
        verbose_name_plural = '图书'


class Author(models.Model):
    name = models.CharField(max_length=100)
    gender = models.BooleanField(default=False)
    book = models.ForeignKey(BookInfo, on_delete=models.CASCADE)

    class Meta:
        verbose_name_plural = '作者'

    def __str__(self):
        info = f'{self.name} : {self.book}'
        return info
